package com.wj.rspmproperty.mapper;

import com.github.pagehelper.Page;
import com.wj.rspmproperty.pojo.User;
import com.wj.rspmproperty.pojo.vo.UnpaidOwner;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author WeiJin
 * @version 1.0
 */


public interface UserMapper {

    /**
     * 添加一条用户
     * @param user
     * @return
     */
    int insertUser(User user);

    /**
     * 查询业主分页信息
     * @return
     */
    Page<User> owners();

    /**
     * 修改用户状态
     * @param user
     * @return
     */
    @Update("update user set user_status = #{user_status} where userid = #{userid}")
    int changeUserStatus(User user);

    @Select("select account, username, user_type, userid, gender, age, user_status, user_roomid, idcard " +
            "from user where userid = #{id}")
    User queryById(Integer id);

    /**
     * 根据账单类型查询欠费用户
     * @param typeId
     * @return
     */
    Page<UnpaidOwner> unpaidOwnerList(Integer typeId);
}
